package com.qf.mybatis02.dao;

import com.qf.mybatis02.entity.User;
import org.apache.ibatis.annotations.*;

public interface UserMapper {

    @Select("select * from t_users where id = #{id}")
    public User getUserById(@Param("id") Integer id);


    @Delete("delete from t_users where id = #{id}")
    public int deleteUserById(@Param("id") Integer id);


    // 开启 主键回填
    @Options(useGeneratedKeys = true,keyProperty = "id")
    @Insert("insert into t_users values (null,#{name},#{password},#{sex},#{birthday},#{registTime},#{auth},#{status})")
    public int insertUser(User user);


    @Update("update t_users set name=#{name},password=#{password},sex=#{sex} where id=#{id}")
    public int updateUser(User user);

}
